import cv2
from pathlib import Path

diml_root = Path('DIML')

tot_cnt = 0

for subdir in sorted(diml_root.iterdir()):
    if not subdir.is_dir() or \
            not str(subdir.name).startswith('DIML-LD-'):
        continue
    #print('Processing', subdir)
    for avi in sorted(subdir.iterdir()):
        cap = cv2.VideoCapture(str(avi))
        cnt = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
        tot_cnt += cnt
        print(avi, cnt)

print(tot_cnt)

